% patch the bodyhead

\chardef\atcode=\catcode`\@
\catcode`\@=11 % \makeatletter

\newcount\entry
\entry=0

\def\bodyhead{\hrule\vskip\blocklineskip
  \line{\ifnum\invoicenumber>0\vbox{\hbox{\footfont\numbername\hfil}
      \hbox{\number\invoiceyear/\the\invoicenumber\hfil}}\hfil\advance\entry1\fi
    \ifnum\customernumber>0\vbox{\hbox{\footfont\customername\hfil}
      \hbox{\the\customernumber\hfil}}\hfil\advance\entry1\fi
    \ifx\order@date\empty\null\else\advance\entry1
      \vbox{\hbox{\footfont\ordername\hfil}
        \hbox{\order@date\hfil}}\hfil\fi
    \ifx\your@ref\empty\null\else\advance\entry1
      \vbox{\hbox{\footfont\yourrefname\hfil}
        \hbox{\your@ref\hfil}}\hfil\fi
    \ifx\my@ref\empty\null\else\ifcase\entry\hfil\fi
      \vbox{\hbox{\footfont\myrefname\hfil}
        \hbox{\my@ref\hfil}}\fi}\bigskip
    \line{\hfil\underbar{\bf\invoicename}\hfil}
    \vskip\blocklineskip\hrule\vskip\positionskip}

\catcode`\@=\atcode % return to previous catcode
